/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.brucexx.wedding.context;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import com.brucexx.wedding.dao.BaseModelDAO;
import com.brucexx.wedding.model.Admin;

/**
 * 
 * @author BruceXX email:brucest0078@gmail.com
 * 
 */
public class SerivceStarter extends HttpServlet {

	private static final long serialVersionUID = -959566823610427046L;

	@Override
	public void init(ServletConfig config) throws ServletException {

		try {
			afterApplication();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	private void afterApplication() throws IOException {
		Admin admin1 = new Admin();
		admin1.setId(new Long(1));
		admin1.setUsername("小田");
		admin1.setRealname("小小田 ");
		admin1.setFlag("00");

		Admin admin2 = new Admin();
		admin2.setId(new Long(2));
		admin2.setUsername("阿照");
		admin2.setRealname("小照哥");
		admin2.setFlag("00");

		Admin admin3 = new Admin();
		admin3.setId(new Long(3));
		admin3.setUsername("锋哥");
		admin3.setRealname("张继锋");
		admin3.setFlag("01");

		Admin admin4 = new Admin();
		admin4.setId(new Long(4));
		admin4.setUsername("默默");
		admin4.setRealname("胡敏");
		admin4.setFlag("02");

		BaseModelDAO.addOrUpdate(admin1);
		BaseModelDAO.addOrUpdate(admin2);
		BaseModelDAO.addOrUpdate(admin3);
		BaseModelDAO.addOrUpdate(admin4);

	}

}
